<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

use Cache;
use App\Models\FarmCategory;

class FarmCategoryController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $result = Cache::remember('categories', 7*24*60, function() {
            return FarmCategory::orderBy('sort_order', 'ASC')
                ->orderBy('id', 'ASC')
                ->get();
        });
        return response()->json($result);
    }
}
